const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
let env = process.env.NODE_ENV
let publicPath = ''
switch (env) {
  case 'production':
    publicPath = '/nx_doctor/'
    break
  case 'development':
    publicPath = '/demo_doctor/'
    break
  default:
    publicPath = '/demo_doctor/'
    break
}
module.exports = {
  outputDir: 'pc_doctor',
  // publicPath: process.env.NODE_ENV === 'production' ? '/' : '/demo_doctor/',
  publicPath: publicPath,

  // devServer: {
  //   proxy: {
  //     '/': {
  //       target: 'http://152.136.185.210:4000',
  //       pathRewrite: {
  //         '^/api': ''
  //       },
  //       changeOrigin: true
  //     }
  //   }
  // },
  configureWebpack: {
    plugins: [
      AutoImport({
        resolvers: [ElementPlusResolver()]
      }),
      Components({
        resolvers: [ElementPlusResolver()]
      })
    ]
  }
}
